<?php
	$item_id	= $params[2];
	$ruleOptions	= _u(sqlOptions("SELECT `title` AS `label`, `rule_id` AS `value` FROM `tbl_discount_rule` WHERE `status` = '1' ORDER BY `priority` ASC"),'discount_rule');

	list($sql,$all_page) = splitPage("`tbl_product_discount` AS `d` LEFT JOIN `tbl_discount_rule` AS `r` ON `d`.`rule_id`  = `r`.`rule_id`","`d`.`item_id` = '$item_id' ORDER BY `r`.`priority` ,`d`.`rule_id` ASC", 30, $_GET['p'],"`d`.* , `r`.`priority` , `r`.`title` , `r`.`percent`");
	$strPage = fetchPage($all_page,$_GET['p']);
	$query = mysql_query($sql);
	$tp->block('result');
	while($result = mysql_fetch_assoc($query)) {
		$discount_id= $result['discount_id'];
		$title		= $result['title'];
		$percent	= $result['percent'];
		$date		= formatDate($result['date'], 'd/m/Y');
		$tp->apply();
	}
	mysql_free_result($query);
?>